<%@page import="oracle.net.aso.e"%>
<%@ page contentType='text/html;charset=utf-8' %>

<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.sql.SQLException" %>
<%
	request.setCharacterEncoding("utf-8");
	String seq=request.getParameter("seq");
	
	Connection conn =null;
	ResultSet rs=null;
	PreparedStatement pstmt = null; 

	String driver = "oracle.jdbc.driver.OracleDriver";
	String url = "jdbc:oracle:thin:@localhost:1521:orcl";
	String user = "scott";
	String password = "tiger";
	
	String subject = "";
	String writer ="";
	String mail ="";
	String wip="";
	String wdate="";
	String hit="";
	String content="";
	
	try{
		Class.forName(driver);
		conn=DriverManager.getConnection(url, user, password);
		
		String sql = "select subject, writer, mail, to_char(wdate,'RR.MM.DD') wdate, hit, wip, content from board1 where seq=? order by asc";
		pstmt = conn.prepareStatement(sql);
		pstmt.setString(1, seq);
	
		rs = pstmt.executeQuery();
		
		if(rs.next()){
			subject = rs.getString("subject");
			writer= rs.getString("writer");
			mail= rs.getString("mail");
			wdate= rs.getString("wdate");
			hit= rs.getString("hit");
			wip= rs.getString("wip");
			//content= rs.getString("content").replace("\r\n", "<br>");  
			//content= (rs.getString("content")=="\r\n") ? "<br>":rs.getString("content");
			content=rs.getString("content"); //<pre> 태그 사용
		}
	}catch(ClassNotFoundException e){
			System.out.println(e.getMessage()+"클래스");
		
	}catch(SQLException e){
			System.out.println(e.getMessage()+"sql 에러");
		
	}finally{
		if(rs!=null) rs.close();
		if(pstmt!=null) pstmt.close();
		if(conn!=null) conn.close();
	}

%>
<html>
<head>
<title></title>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8'>
<link rel='stylesheet' type='text/css' href='../images/common.css'>
</head>

<body bgcolor='#ffffff' topmargin='5' rightmargin='0' leftmargin='5' bottommargin='10'>

<table width='750px' border='0' cellpadding='0' cellspacing='0' align='center'>
<tr>
	<td height='23' bgcolor='#f0f0f0' align='right'></td>
</tr>
<tr>
	<td bgcolor='#ffffff' style='padding:20'>
		<table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'>
		<tr>
			<td height='25'><font class='titdot'>&#149;&nbsp;</font><font class='title'>제목</font> | <%=subject %></td>
		</tr>
		<tr>
			<td class='imgline'></td>
		</tr>
		<tr>
			<td height='25'><font class='titdot'>&#149;&nbsp;</font><font class='title'>이름</font> | <%=writer %>(<%=mail %>) (<%=wip %>)</td>
		</tr>
		<tr>
			<td class='imgline'></td>
		</tr>
		<tr>
			<td height='25'>
				<table width='100%' cellpadding='0' cellspacing='0' border='0' align='center'>
				<tr>
					<td><font class='titdot'>&#149;</font><font class='title'> 날짜</font> | <%=wdate %></td>
					<td align='right'><font class='titdot'>&#149;&nbsp;</font><font class='title'>조회</font> |<%=hit %></td>
				</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td  class='imgline'></td>
		</tr>
		<tr>
			<td height='100'><pre><%=content %></pre></td>  <!-- <pre>태그 : 있는 그대로 보여주기 -->
		</tr>
		</table>

		<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'>
		<tr>
			<td id='tailarea'></td>
		</tr>
		</table>

		<table width='100%' border='0' cellspacing='1' cellpadding='1'>
		<tr>
			<td colspan='2' class='gline'></td>
		</tr>
		<tr>
			<td width='500' height='30'>
				<a href='board_write1.jsp'><img src='../images/btn_wri.gif' border='0'></a>				  
				<a href='board_modify1.jsp?seq=<%=seq %>'><img src='../images/btn_mod.gif' border='0'></a>
				<a href='board_delete1.jsp?seq=<%=seq %>'><img src='../images/btn_del.gif' border='0'></a>
			</td>
			<td align='right'>
				<a href='board_list1.jsp'><img src='../images/btn_list.gif' border='0'></a>
			</td>
		</tr>
		<tr>
			<td colspan='2' class='gline'></td>
		</tr>
		</table>
	</td>
</tr>
</table>		
		
<table width='750px' border='0' cellpadding='0' cellspacing='0' align='center'>
<tr>
	<td height='15' bgcolor='#f0f0f0' style='padding:5' align='center'></td>
</tr>
</table>

</body>
</html>
